#include"class.h"


// User 类的实现
User::User() : id(0), age(0) {}

User::User(int id, const QString& username, const QString& password, const QString& gender,
           int age, const QString& phone, const QString& state, const QString& note)
    : id(id), username(username), password(password), gender(gender),
    age(age), phone(phone), state(state), note(note) {}

User::User(const User& other)
    : id(other.getId()), username(other.getUsername()), password(other.getPassword()),
    gender(other.getGender()), age(other.getAge()), phone(other.getPhone()),
    state(other.getState()), note(other.getNote()) {}

User::~User() {}

int User::getId() const { return id; }
void User::setId(int newId) { id = newId; }

QString User::getUsername() const { return username; }
void User::setUsername(const QString& newUsername) { username = newUsername; }

QString User::getPassword() const { return password; }
void User::setPassword(const QString& newPassword) { password = newPassword; }

QString User::getGender() const { return gender; }
void User::setGender(const QString& newGender) { gender = newGender; }

int User::getAge() const { return age; }
void User::setAge(int newAge) { age = newAge; }

QString User::getPhone() const { return phone; }
void User::setPhone(const QString& newPhone) { phone = newPhone; }

QString User::getState() const { return state; }
void User::setState(const QString& newState) { state = newState; }

QString User::getNote() const { return note; }
void User::setNote(const QString& newNote) { note = newNote; }

// 实现 toQString 方法
QString User::toQString() const {
    return QString("ID: %1 Username: %2 Password: %3 Gender: %4 Age: %5 Phone: %6 State: %7 Note: %8")
    .arg(id)
        .arg(username)
        .arg(password)
        .arg(gender)
        .arg(age)
        .arg(phone)
        .arg(state)
        .arg(note);
}

// Friend 类的实现
Friend::Friend() {}

Friend::Friend(int id, const QString& username1, const QString& username2)
    : id(id), username1(username1), username2(username2) {}

Friend::Friend(const Friend& other)
    : id(other.getId()), username1(other.getUsername1()), username2(other.getUsername2()) {}

int Friend::getId() const { return id; }
void Friend::setId(int newId) { id = newId; }

QString Friend::getUsername1() const { return username1; }
void Friend::setUsername1(const QString& newUsername1) { username1 = newUsername1; }

QString Friend::getUsername2() const { return username2; }
void Friend::setUsername2(const QString& newUsername2) { username2 = newUsername2; }

// Group 类的实现
Group::Group() {}

Group::Group(int id, const QString& username1, const QString& groupName, const QString& username2)
    : id(id), username1(username1), groupName(groupName), username2(username2) {}

Group::Group(const Group& other)
    : id(other.getId()), username1(other.getUsername1()), groupName(other.getGroupName()), username2(other.getUsername2()) {}

int Group::getId() const { return id; }
void Group::setId(int newId) { id = newId; }

QString Group::getUsername1() const { return username1; }
void Group::setUsername1(const QString& newUsername1) { username1 = newUsername1; }

QString Group::getGroupName() const { return groupName; }
void Group::setGroupName(const QString& newGroupName) { groupName = newGroupName; }

QString Group::getUsername2() const { return username2; }
void Group::setUsername2(const QString& newUsername2) { username2 = newUsername2; }
